package com.syni.mdd.sjb.common.datatreaure.controller.protect.order;

import com.syni.mdd.sjb.common.component.utils.common.annotations.CheckUserIdentity;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rq.order.GenerateOrderRqVo;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rq.sms.SmsOrderRqVo;
import com.syni.mdd.sjb.common.datatreaure.service.DxshAppServiceOrderService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 服务订单
 */
@RestController
@RequestMapping("order")
public class OrderController {

    @Autowired
    DxshAppServiceOrderService dxshAppServiceOrderService;

    @PostMapping("generateOrder")
    @ApiOperation(value = "生成服务订单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "serviceId",value = "购买服务ID"),
            @ApiImplicitParam(name = "serviceNum",value = "购买服务数量"),
            @ApiImplicitParam(name = "phone",value = "手机"),

    })
    @CheckUserIdentity
    public Map<String,Object> generateOrder(@RequestBody @Validated GenerateOrderRqVo generateOrderRqVo){
        return dxshAppServiceOrderService.generateOrder(generateOrderRqVo);
    }

    @PostMapping("generateSmsOrder")
    @ApiOperation(value = "生成短信订单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "smsServiceId",value = "购买短信服务ID")

    })
    @CheckUserIdentity
    public Map<String,Object> generateSmsOrder(@RequestBody @Validated SmsOrderRqVo smsOrderRqVo){
        return dxshAppServiceOrderService.generateSmsOrder(smsOrderRqVo);
    }
}
